Name Property (Field Object) 

The Name property returns the name of the field as a string. Read-only.

Syntax

objField.Name

Data Type

String

Remarks

The Name property is read-only. You set the name of the Field object at the time you create it, when you call the Fields collection s Add method.

Note that Field objects used to access MAPI properties do not have names. Names can appear only on the custom properties that you create. For more information, see the Item property documentation for the Fields collection.

Example

' fragment from Fields_Add

Dim objNewField As Object ' new Field object

    Set objNewField = objFieldsColl.Add( _

                      Name:="Keyword", _

                      Class:=vbString, _

                      Value:="Peru")

    If objNewField Is Nothing Then

        MsgBox "could not create new Field object"

        Exit Function

    End If

    cFields = objFieldsColl.Count

    MsgBox "new Fields collection count = " & cFields

' fragment from Field_Name; modified to use objNewField for active Field

    If "" = objNewField.Name Then

        MsgBox "Field has no name; ID = " & objNewField.Id

    Else

        MsgBox "Field name = " & objNewField.Name

    End If

 

See Also

Add, Method (Fields Collection)